home *** CD-ROM | disk | FTP | other *** search
- Copyright (C) 1989, 1990 Aladdin Enterprises. All rights reserved.
- Distributed by Free Software Foundation, Inc.
-
- This file is part of Ghostscript.
-
- Ghostscript is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
- to anyone for the consequences of using it or for whether it serves any
- particular purpose or works at all, unless he says so in writing. Refer
- to the Ghostscript General Public License for full details.
-
- Everyone is granted permission to copy, modify and redistribute
- Ghostscript, but only under the conditions described in the Ghostscript
- General Public License. A copy of this license is supposed to have been
- given to you along with Ghostscript so you can know your rights and
- responsibilities. It should be in a file named COPYING. Among other
- things, the copyright notice and this notice must be preserved on all
- copies.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- This file, extend.doc, describes the Ghostscript extensions to the
- PostScript language.
-
- For an overview of Ghostscript and a list of the documentation files, see
- README.
-
- The Ghostscript language bears a very strong resemblance to the PostScript
- (TM) language. The current release of Ghostscript, unless otherwise
- noted, is intended to conform exactly to the definition of the PostScript
- language as presented in the April 1986 printing of the PostScript
- reference manual published by Addison-Wesley, augmented by the following
- extensions published by Adobe:
-
- - The CMYK color operator extensions;
-
- - The minor additions for version 25.0 of the Postscript language;
-
- - A few of the Display PostScript operators (indicated below).
-
- The following summarizes features of the Ghostscript language that extend
- the PostScript language. Note that some of the added operators are
- actually implemented as Ghostscript language procedures in the
- initialization file ghost.ps.
-
- Aladdin Enterprises intends to extend Ghostscript over time to implement
- the facilities of Level 2 PostScript. Facilities of Display PostScript or
- Level 2 PostScript are indicated with (D) or (2) below.
-
- Miscellaneous
- -------------
-
- \r and ^Z are counted as whitespace.
-
- readhexstring can take either a file or a string as the source of
- characters. In the latter case, it leaves the remainder of the string on
- the stack, just as for the token operator.
-
- run can take either a string or a file as its argument. In the former
- case, it uses findlibfile to open the file (searching directories as
- needed). In the latter case, it just runs the file, closing it at the
- end, and trapping errors just as for the string case.
-
- Mathematical operators
- ----------------------
- <number> arccos <number>
- Computes the arc cosine of a number between -1 and 1.
- <number> arcsin <number>
- Computes the arc sine of a number between -1 and 1.
-
- Dictionary operators
- --------------------
- <dict> <integer> setmaxlength -
- Changes the capacity of a dictionary, preserving its
- contents. Causes a dictfull error if the requested
- capacity is less than the current number of occupied
- entries.
-
- Relational operators
- --------------------
- <number|string> <number|string> max <number|string>
- Returns the larger of two numbers or strings.
- <number|string> <number|string> min <number|string>
- Returns the smaller of two numbers or strings.
-
- File operators
- --------------
- <state> <file> type1decryptfile <newFile>
- Creates a pseudo-file for decrypting a file that contains
- hex characters (as for readhexstring) that represent an
- encrypted string. The pseudo-file is only available for
- reading.
- (D) <string> deletefile -
- Deletes the file with the given name. If the operating
- system will not delete the file, causes an ioerror.
- <file> eexec -
- Starts reading and interpreting the indicated file in the
- manner of the exec operator, but treats the contents of
- the file as hex characters (as for readhexstring) and
- applies eexec decryption to the data (type 1 decryption
- with a seed of 55665).
- eexec works by creating a pseudo-file, which then
- becomes the current file. When the pseudo-file is
- closed, this is treated as the end of the encrypted
- section, and the interpreter resumes reading from its
- previous input, just as for exec.
- eexec may read as many as 512 characters beyond the end of
- the encrypted section, so a technique like the following
- is advisable:
- mark
- currentfile eexec
- ... encrypted section ...
- 000...000 ... 512 0's ...
- cleartomark
- The cleartomark removes any 0s that have been pushed on
- the stack.
- <file> filename <string>
- Returns the name of the file. Note that for files opened
- by findlibfile, this is the name of the file that was
- finally opened, which may be different from the name
- originally supplied.
- (D) <file> fileposition <integer>
- Returns the current position within the file. If the
- notion of position is not meaningful for this file,
- causes an ioerror error.
- <string> findlibfile <file> true or <string> false
- Opens the file of the given name for reading. If the file
- cannot be opened using the supplied name, searches
- through directories as described in interp.doc. If the
- search fails, findlibfile simply pushes false on the
- stack and returns, rather than causing an error.
- (D) <string1> <string2> renamefile -
- Renames the file named string1 to have the name string2.
- If the operating system will not rename the file,
- causes an ioerror.
- (D) <file> <integer> setfileposition -
- Sets the current position within the file. If the notion
- of position is not meaningful for this file, or if the
- file is only open for writing, causes an ioerror error.
- If the position is negative or beyond the end of the
- file, causes a rangecheck error.
- <file> <integer> unread -
- Pushes back the given character onto the front of the
- file. If the file is only open for writing, or if the
- C library call (ungetc) fails, causes an ioerror error.
- If the integer is not in the range [0..255], causes
- a rangecheck error.
- <file> <device> writeppmfile -
- Writes the contents of the device, which must be an image
- device, onto the file, in Portable PixMap (ppm) format.
- Does not close the file.
-
- Miscellaneous operators
- -----------------------
- - currenttime <number>
- Returns the current value of a continuously-running timer,
- in minutes. The initial value of this timer is undefined.
- <string> getenv <string> true or false
- Looks up a name in the shell environment. If the name is
- found, returns the corresponding value and true; if the
- name is not found, returns false.
- <string> <boolean> setdebug -
- If the Ghostscript interpreter was built with the DEBUG
- flag set, sets or resets any subset of the debugging
- flags normally controlled by -Z in the command line.
- Has no effect otherwise.
- <state> <fromString> <toString> type1encrypt <newState> <toSubstring>
- Encrypts fromString according to the algorithm for Adobe
- Type 1 fonts, writing the result into toString.
- toString must be at least as long as fromString or a
- rangecheck error occurs. state is the initial state of
- the encryption algorithm (a 16-bit non-negative
- integer); newState is the new state of the algorithm.
- <state> <fromString> <toString> type1decrypt <newState> <toSubstring>
- Decrypts fromString according to the algorithm for Adobe
- Type 1 fonts, writing the result into toString. Other
- specifications are as for type1encrypt.
-
- Graphics state operators
- ------------------------
- - currentcolor <color>
- Returns a color object (a new kind of object) representing
- the current color/gray from the graphics state.
- <color> setcolor -
- Sets the current color in the graphics state according to
- a color object.
-
- Color operators
- ---------------
- <h> <s> <b> hsbcolor <color>
- Constructs a color object from hue, saturation, and
- brightness values.
- <r> <g> <b> rgbcolor <color>
- Constructs a color object from red, green, and blue values.
- <color> colorhsb <h> <s> <b>
- Inverts the action of hsbcolor.
- <color> colorrgb <r> <g> <b>
- Inverts the action of rgbcolor.
-
- Painting operators
- ------------------
- (D) <x1> <y1> <x2> <y2> <r> arct -
- Performs the same function as arcto, but does not
- push the tangent points on the stack.
-
- Device operators
- ----------------
- <index> getdevice <device>
- Returns a device from the set of devices known to the
- system. The first device, which is default, is numbered
- 0. If the index is out of range, causes a rangecheck
- error.
- <device> devicename <string>
- Gets the name of a device. The devices currently
- supported are listed in gdevs.mak.
- <matrix> <width> <height> <palette> makeimagedevice <device>
- Makes a new device that accumulates an image in memory.
- palette is an array of color objects that specify how
- the pixel values will be interpreted, e.g., if you want
- a monochrome image for which 0=white and 1=black, the
- palette should be the result of executing
- [ 1 1 1 rgbcolor 0 0 0 rgbcolor ]
- The palette must contain exactly 2, 4, 16, or 256
- entries, and must contain an entry for black and an
- entry for white; aside from this, its contents are
- arbitrary. Each pixel occupies log2(colormap size)
- bits.
- Alternatively, palette can be null. This is interpreted
- as 32-bit-per-pixel color, where the four bytes of each
- pixel are respectively unused, R, G, and B.
- Note that one can also make an image device (with the same
- colormap as an existing image device) using makedevice.
- ****** NOTE: the current implementation of makeimagedevice
- only supports 1-, 8-, and 32-bit-per-pixel devices. ******
- <device> <index> <string> copyscanlines <substring>
- Copies one or more scan lines from an image device into a
- string, starting at a given scan line in the image.
- The data is in the same format as for the image
- operator. Error if the device is not an image device or
- if the string is too small to hold at least one complete
- scan line. Always copies an integral number of scan
- lines.
- <device> <matrix> <width> <height> makedevice <device>
- Makes a new device just like an existing one, but with a
- specified width, height, and initial transformation.
- Note that the width is in pixels, not in bytes as in
- framedevice.
- <device> setdevice -
- Sets the current device to the specified device. Also
- resets the transformation and clipping path to the
- initial values for the device.
- - currentdevice <device>
- Gets the current device from the graphics state.
- <device> <matrix> deviceparams <<mark>> <matrix> <width> <height>
- Gets the parameters of a device. Some devices may have
- additional parameters betwen the mark and the matrix:
- one should use cleartomark to remove the output of
- deviceparams from the stack.
- - flushpage -
- On displays, flushes any buffered output, so that it
- is guaranteed to show up on the screen; on printers,
- has no effect.
-
- Character operators
- -------------------
- <string> type1addpath -
- Adds the description of a character to the current path,
- and then optionally render the character. The string
- argument is a scalable description encoded in Adobe Type
- 1 format. This operator is only valid in the context of
- a show operator, like setcharwidth and setcachedevice.
- It uses information from the current font, in addition
- to the argument.
- <image> <width> <height> <wx> <wy> <ox> <oy> <string>
- type1imagepath <substring>
- Converts an image (bitmap) description of a character into
- a scalable description in Adobe Type 1 format. The
- current transformation matrix should be the same as the
- FontMatrix of the font in which this character will be
- used: this establishes the scaling relationship between
- image pixels (the image is assumed to be 1 unit high in
- user space) and the character coordinate system used in
- the scalable description. wx and wy are the character
- width, and ox and oy are the character origin relative
- to the lower left corner of the bitmap, in *pixels*.
- All coordinates in the scalable description are rounded to
- integers, so the coefficients in the FontMatrix should
- be on the order of 1/N for some value of N that is
- either a multiple of the height/width or is large
- compared to the width and height. (There is a
- convention, which some P*stScr*pt programs rely on, that
- N=1000.)
- Note that the encoded description has *not* been subjected
- to CharString encryption, which is necessary before the
- description can be given to type1addpath: to do this,
- follow the type1imagepath with
- 4330 exch dup type1encrypt exch pop
- If the description is too complex to fit into the supplied
- string, a limitcheck error results. A good rule of
- thumb is that the size of the string should be about 6
- times the number of 1-bits in the image that are not
- completely surrounded by other 1-bits.
- <font> <char> Type1BuildChar -
- This is not a new operator: rather, it is a name known
- specially to the interpreter. Whenever the interpreter
- needs to render a character (during a ...show,
- stringwidth, or charpath), it looks up the name
- BuildChar in the font dictionary to find a procedure to
- run. If it does not find this name, and if the FontType
- is 1, the interpreter instead uses the value (looked up
- on the dictionary stack in the usual way) of the name
- Type1BuildChar.
- The standard definition of Type1BuildChar is in gfonts.ps.
- Users should not need to redefine Type1BuildChar, except
- perhaps for tracing or debugging.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- PostScript is a trademark of Adobe Systems, Incorporated.
-